<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="generator"
          content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta charset="UTF-8">
    <title>车主发布</title>
    <link rel="stylesheet" href="./css/base.css"/>
    <link rel="stylesheet" href="./css/index.css"/>
    <link rel="stylesheet" href="./css/car_owner.css"/>
    <link rel="stylesheet" href="./css/mobiscroll.css"/>
    <link rel="stylesheet" href="./css/mobiscroll_date.css"/>
    <link rel="stylesheet" type="text/css" href="./css/mobiscroll.core-2.6.2.css"/>
</head>
<body>
<div class="home-top">
    <a style="float:left;" href="javascript:history.go(-1);">返回</a>
    <a href="login.html">登录</a></div>
<!--<form id="form_info" action="/ride/carowner/publishcarmessage.do">-->
<div class="content">
    <table id="overaddress">
        <tr>
            <td>始发地</td>
            <td><select name="select_sfd" id="select_sfd">
                <option value="188">请选择</option>
                <option value="北京市">北京市</option>
                <option value="承德市">承德市</option>
                <option value="天津市">天津市</option>
                <option value="石家庄市">石家庄市</option>
                <option value="唐山市">唐山市</option>
                <option value="廊坊市">廊坊市</option>
                <option value="秦皇岛市">秦皇岛市</option>
                <option value="保定市">保定市</option>
                <option value="张家口市">张家口市</option>
                <option value="沧州市">沧州市</option>
                <option value="衡水市">衡水市</option>
                <option value="邢台市">邢台市</option>
                <option value="邯郸市">邯郸市</option>
            </select></td>
        </tr>
        <tr>
            <td>目的地</td>
            <td>
                <select name="select_mdd" id="select_mdd">
                    <option value="188">请选择</option>
                    <option value="承德市">承德市</option>
                    <option value="北京市">北京市</option>
                    <option value="天津市">天津市</option>
                    <option value="石家庄市">石家庄市</option>
                    <option value="唐山市">唐山市</option>
                    <option value="廊坊市">廊坊市</option>
                    <option value="秦皇岛市">秦皇岛市</option>
                    <option value="保定市">保定市</option>
                    <option value="张家口市">张家口市</option>
                    <option value="沧州市">沧州市</option>
                    <option value="衡水市">衡水市</option>
                    <option value="邢台市">邢台市</option>
                    <option value="邯郸市">邯郸市</option>
                </select></td>
        </tr>
        <tr>
            <td>途径地点</td>
            <td ><input class="address" type="text" placeholder="途径地点"><a href="javascript:void(0) " id="addaddress">添加</a></td>
        </tr>
        </table>
            <table>
        <tr>
            <td>出发日期</td>
            <td><input type="text" name="date" id="date" placeholder="选择日期" readonly/></td>
        </tr>
        <tr>
            <td>出发时间</td>
            <td>
                <select id="select_sj" name="select_sj" class="demos" data-role="none">
                    <option value="0">00:00-24:00</option>
                    <option value="1">00:00-06:00</option>
                    <option value="2">06:00-12:00</option>
                    <option value="3">12:00-18:00</option>
                    <option value="4">18:00-24:00</option>
                </select></td>
        </tr>

    </table>

    <table>
        <tr>
            <td>车型</td><td><input id="car_type" name="car_type" type="text" placeholder="车型"></td>
        </tr>
        <tr>
            <td>空余座位</td><td><input id="seat_num" name="seat_num" type="text" placeholder="数目"></td>
        </tr>
        <tr>
            <td>价格</td><td><input id="price" name="price" type="text" placeholder="价格"></td>
        </tr>
        <tr>
            <td>可接送</td><td><input id="if_shuttle" name="if_shuttle" type="checkbox"></td>
        </tr>
    </table>
    <table>
        <tr>
            <td>车主姓名</td><td><input id="name" name="name" type="text" placeholder="车主姓名"></td>
        </tr>
        <tr>
            <td>联系电话</td><td><input id="phone" name="phone" type="text" placeholder="联系电话"> </td>
        </tr>
        <tr><td>备注信息</td><td><input id="content" type="text" name="content" placeholder="备注信息"></td></tr>
    </table>



    <div class="submit_fb">
        <input id="submit" type="submit"  value="确认发布"/>
    </div>

</div>

<script type="text/javascript" src="./js/zepto.min.js"></script>
<script type="text/javascript" src="./js/swipe.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./js/mobiscroll.core-2.6.2.js" type="text/javascript"></script>
<script src="./js/mobiscroll_date.js" charset="gb2312"></script>
<script src="./js/mobiscroll.select-2.6.2.js" type="text/javascript"></script>
<script src="./js/mobiscroll.js"></script>
<script>
    $(function () {
        var currYear = (new Date()).getFullYear();
        var opt = {};
        opt.date = {preset: 'date'};
        opt.datetime = {preset: 'datetime'};
        opt.time = {preset: 'time'};
        opt.select = {preset: 'select'};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'modal', //显示方式
            mode: 'scroller', //日期选择模式
            dateFormat: 'yyyy-mm-dd',
            lang: 'zh',
            startYear: currYear - 50, //开始年份
            endYear: currYear + 10 //结束年份
        };

        $("input[name='date']").mobiscroll($.extend(opt['date'], opt['default']));
        $('#select_mdd').val('').scroller('destroy').scroller($.extend(opt['select'], opt['default']));
        $('#select_sfd').val('').scroller('destroy').scroller($.extend(opt['select'], opt['default']));
        $('#select_sj').val('').scroller('destroy').scroller($.extend(opt['select'], opt['default']));

    });
</script>
<script>
    var row=1;
    $(function() {
        $("#addaddress").click(function(){
            row++;
            $("#overaddress").append("<tr id='"+row+"'> <td>途径地点"+row+"</td> <td ><input class='address' type='text' placeholder='途径地点'><a href='javascript:rmaddress("+row+")'>去掉</a></td></tr>");

        });



        $("#submit").click(function () {

            var address_list = '';
            $(".address").each(function () {
                if (address_list == '') {

                    address_list=$(this).val();
                }
                else {
                    address_list = address_list + '-' + $(this).val();
                }
            });


            alert(address_list);
            var select_sfd = $("#select_sfd").val();
            var select_mdd = $("#select_mdd").val();
            var date = $("#date").val();
            var select_sj = $("#select_sj").val();
            var car_type = $("#car_type").val();
            var seat_num = $("#seat_num").val();
            var price = $("#price").val();
            var if_shuttle = $("#if_shuttle").val();
            var name = $("#name").val();
            var phone = $("#phone").val();
            var content = $("#content").val();


            $.ajax({
                type: "get",
                url: "/ride/carowner/publishcarmessage.do",
                dataType: 'json',
                contentType: 'application/json',
                data: {
                    "dpt": select_sfd,
                    "arr": select_mdd,
                    "route":address_list,
                    "date":date,
                    "time":select_sj,
                    "car_type":car_type,
                    "seat_num":seat_num,
                    "price":price,
                    "if_shuttle":if_shuttle,
                    "name":name,
                    "phone":phone,
                    "content":content
                },
                success: function (msg) {

                }
            });
        }) ;





    });
    function rmaddress(aa){

        $("#"+aa).remove();
        row--;
    }





</script>
</body>
</html>